<style scoped>
.b1:hover{
    cursor: pointer;
}
p{
    /* float: left; */
    margin: 0px;
}
h3{
    margin-bottom: 0px;
    margin-top: 2px;
    margin-left: 20px;
}
.touxiang{
    float: left;
    position: relative;
    background-color: rgb(255, 255, 255);
    width: 80px;
    height: 80px;
    border-radius: 100%;
}
.touxiang img{
    width: 80px;
    height: 80px;
    border-radius: 100%;
}
.itd{
    box-shadow: 0px -5px 15px;
    background-color: rgb(186, 203, 245);
    width: 480px;
    height: 80px;

}
.b1{
    display: flex;
    align-items: flex-end;
    /* background: url(../../public/static/BGP.png); */
    margin-top: 10px;
    width: 480px;
    height: 200px;
    background-color: rgb(177, 216, 203);
}
.all{
    overflow-y: scroll;
    margin-top: 10px;
    float: left;
    /* margin: auto; */
    width: 500px;
    height: 680px;
    
}   
.date{
    font-size: 13px;
    float: right;
    margin-right: 9px;
    color: rgb(126, 126, 126);
}
@media (prefers-color-scheme: dark) {
    .itd{
        background-color: rgb(31, 104, 152);
        color: rgb(9, 38, 62);
    }
    
}
</style>
<template>
 <div class="all">
    <!-- @click="goTo" -->
<div class="b1" v-for="b in blogs" :style="{background:`url(${b.bkImg})`}" @click="goTo(b.pid)" >
    <!-- <img :src= "b.bkImg" /> -->
    <div class="itd">
        
        <div class="touxiang">
            <img :src="b.touxiang" />
        </div>
        <!-- <span>{{  }}</span> -->
        <h3>{{ b.title }}</h3>
        <p>{{ b.drcs }}</p>
        <span class="date">{{ b.date }}</span>
    </div>
    
</div>
 </div>

</template>
<script lang="ts" setup>
import { ref } from 'vue';
import router from '../router/router';
import { useRoute } from 'vue-router';
import { getList,seletByFenlei } from '../API/list';
import Content from './content.vue';

// import {  useRoute } from 'vue-router';

const route = useRoute();
// function fenlei (id = route.query.id){
//     id typeof id !=
// }
let blogs = ref(
// [{
//     bkImg: '../../public/static/BGP.png',
//     title:"标题1",
//     touxiang:"URL",
//     drcs:"假装这里是关于这一项的描述",
//     date:"2025/3/19"
// },
// {
//     bkImg: '../../public/static/xiubi.png',
//     title:"标题1",
//     touxiang:"URL",
//     drcs:"假装这里是关于这一项的描述",
//     date:"2025/3/19"
// },{
//     bkImg: '../../public/static/BGP.png',
//     title:"标题1",
//     touxiang:"URL",
//     drcs:"假装这里是关于这一项的描述",
//     date:"2025/3/19"
// },{
//     bkImg: '../../public/static/BGP.png',
//     title:"标题1",
//     touxiang:"URL",
//     drcs:"假装这里是关于这一项的描述",
//     date:"2025/3/19"
// },{
//     bkImg: '../../public/static/BGP.png',
//     title:"标题1",
//     touxiang:"URL",
//     drcs:"假装这里是关于这一项的描述",
//     date:"2025/3/19"
// },]
)

seletByFenlei(route.query.id).then(res => {
    // console.log(res.data.blogs)
    // console.log()
    // console.log(route.query.id)
    blogs.value = res.data.data.blogs

//   router.go(0)
});
// getList().then(res => {
//     blogs.value = res.data.data.blogs
// })

console.log(blogs)
const print = () => {
    //这里以及获得参数了
    // console.log(route.query.id)
}

// const query = router.

const goTo = (pid : any) => {
    router.push({
    name: "Context",
    query: {
        pid:pid
    }   
   })
    
    // window.location.href = '/context'
}
const brick = ref([{
    bkImg: '../../public/static/BGP.png',
    title:"标题1",
    touxiang:"URL",
    drcs:"假装这里是关于这一项的描述",
    date:"2025/3/19"
},
{
    bkImg: '../../public/static/xiubi.png',
    title:"标题1",
    touxiang:"URL",
    drcs:"假装这里是关于这一项的描述",
    date:"2025/3/19"
},{
    bkImg: '../../public/static/BGP.png',
    title:"标题1",
    touxiang:"URL",
    drcs:"假装这里是关于这一项的描述",
    date:"2025/3/19"
},{
    bkImg: '../../public/static/BGP.png',
    title:"标题1",
    touxiang:"URL",
    drcs:"假装这里是关于这一项的描述",
    date:"2025/3/19"
},{
    bkImg: '../../public/static/BGP.png',
    title:"标题1",
    touxiang:"URL",
    drcs:"假装这里是关于这一项的描述",
    date:"2025/3/19"
},])
</script>
